package com.gewu.pm.ui.adapter.home;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;
import com.gewu.pm.bean.TestBean;

/**
 * 未下单客户报表列表适配器
 */
public class NoOrderCustomerAdapter extends AppAdapter<TestBean> {

    public NoOrderCustomerAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ItemViewHolder();
    }

    private final class ItemViewHolder extends AppAdapter<?>.ViewHolder {

        private final TextView mTitleView;
        private final TextView mVehicleCodeView;
        private final TextView mDistributorView;
        private final TextView mOrderTimeView;

        private ItemViewHolder() {
            super(R.layout.no_order_customer_item);
            mTitleView = findViewById(R.id.tv_title);
            mVehicleCodeView = findViewById(R.id.tv_vehicle_code);
            mDistributorView = findViewById(R.id.tv_distributor);
            mOrderTimeView = findViewById(R.id.tv_order_time);
        }

        @Override
        public void onBindView(int position) {
            TestBean item = getItem(position);
            
            // 设置客户名称
            mTitleView.setText(item.getName());
            
            // 固定写死的内容
            mVehicleCodeView.setText("1928A");
            mDistributorView.setText("宁波小配送1号车");
            mOrderTimeView.setText("-");
        }
    }
}
